package com.ihg.hiex.entity.session.event;

import java.util.Date;

import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import org.springframework.format.annotation.DateTimeFormat;

import com.demo2do.core.format.PersistentFormat;
import com.ihg.hiex.entity.session.Session;

/**
 * 
 * @author mohanlan
 *
 */
@Entity
@Table(name = "session_event")
public class SessionEvent {
    
    @Id
    @GeneratedValue
    private Long id;
    
    @ManyToOne(fetch = FetchType.LAZY, optional = true)
    @PersistentFormat
    private Session session;
    
    /** 
     * 审核状态
     *1，备选
     *2， 已审核，待引入
     *3，合格
     *4，驳回
     * 
     */
    @Enumerated(EnumType.ORDINAL)
    private Type type;
    
    /**
     * 操作记录
     */
    @org.hibernate.annotations.Type(type="text")
    private String description; 
    
    /** 操作人Id  */
    private Long operatorId;
    
    /** 操作时间  */
    @DateTimeFormat(pattern = "yyyy-MM-dd hh:mm:ss")
    private Date operateTime;
    
    /**
     * The default constructor
     */
    public SessionEvent() {
    }
    
    /**
     * 
     * @param session
     * @param type
     * @param description
     * @param operatorId
     */
    public SessionEvent(Session session, Type type, String description, Long operatorId) {
        this.session = session;
        this.type = type;
        this.description = description;
        this.operatorId = operatorId;
        this.operateTime = new Date();
    }

    /**
     * @return the id
     */
    public Long getId() {
        return id;
    }

    /**
     * @return the session
     */
    public Session getSession() {
        return session;
    }

    /**
     * @return the type
     */
    public Type getType() {
        return type;
    }

    /**
     * @return the description
     */
    public String getDescription() {
        return description;
    }

    /**
     * @return the operatorId
     */
    public Long getOperatorId() {
        return operatorId;
    }

    /**
     * @return the operateTime
     */
    public Date getOperateTime() {
        return operateTime;
    }

    /**
     * @param id the id to set
     */
    public void setId(Long id) {
        this.id = id;
    }

    /**
     * @param session the session to set
     */
    public void setSession(Session session) {
        this.session = session;
    }

    /**
     * @param type the type to set
     */
    public void setType(Type type) {
        this.type = type;
    }

    /**
     * @param description the description to set
     */
    public void setDescription(String description) {
        this.description = description;
    }

    /**
     * @param operatorId the operatorId to set
     */
    public void setOperatorId(Long operatorId) {
        this.operatorId = operatorId;
    }

    /**
     * @param operateTime the operateTime to set
     */
    public void setOperateTime(Date operateTime) {
        this.operateTime = operateTime;
    }
}
